<template>
	<view class="content">
		<!-- <image class="logo" src="/static/logo.png"></image> -->
		<!-- <view class="text-area">
			<text class="title">{{title}}</text>
		</view>
		<view class="num">
			<button @click="num++">{{num}}</button>
			<input type="text" v-model="num">
			<view>{{10+9}}</view>
			<view>{{title.length}}</view>
			<view>{{title.split("").reverse().join("")}}</view>
			<view>{{title.length>10?'长':'短'}}</view>
			<view></view>
		</view> -->




		<view class="title h1">事件</view>
		<view class="shijian">
			<button v-on:click="num++">{{num}}事件绑定</button>
			<button @click="num++">{{num}}事件绑定简写</button>
			<button @click="say" size="min" type="primary">响应函数</button>
			<button @click="say('我是嫩爹')" size="mini" type="warn">响应函数-传参</button>
			<button type="primary" @click="doit" :data-title="title">事件对象</button>
		</view>

		<view class="title h1">属性渲染</view>
		<view class="cont">
			<view class="title">
				{{title}}-{{time}}-{{num}}
			</view>
			<!-- <input class="input" type="text" placeholder="请输入" :value="title" v-model="title"> -->
			<picker mode="time" v-model="time" :value="time" start="09:12" end="12:09"
				@change="time=$event.detail.value">
				<view class="uni-input">{{time}}</view>
			</picker>
			<view>
				{{num}}
			</view>
			<slider :value="num" step="5" @change="num=$event.detail.value" />

		</view>

		<view>
			<view class="title h1">属性渲染</view>
			<button class="button" type="primary" v-bind:disabled="isLog" @click="isLog=!isLog">按钮</button>
			<button class="button" type="warn" :disabled="!isLog" @click="isLog=!isLog">按钮</button>
			<view class="title h1">列表渲染</view>
			<view class="title h2">遍历列表</view>
			<view v-for="(item,index) in list" :key="index">{{item}}</view>
			<view class="title h2">遍历对象</view>
			<view v-for="(item,index) in obj" :key="index">{{item}}</view>
			<view class="title h2">遍历数字</view>
			<view v-for="(item,index) in 5" :key="index">{{item}}</view>
			<view class="title h2">遍历字符串</view>
			<view v-for="(item,index) in title" :key="index">{{item}}</view>
		</view>


	</view>

</template>

<script>
	export default {
		methods: {
			say(str = "你好") {
				// 弹出提示
				uni.showToast({
					title: str
				})
			},
			doit(e) {
				console.log(e)
				// 弹框对话框
				uni.showModal({
					title: e.target.dataset.title
				})
			}
		},
		data() {
			return {
				time: "09:12",
				obj: {
					name: "xingshuaibing",
					age: 18,
					job: "teacher"
				},
				title: 'Hello',
				num: 9,
				str: "<strong>社会主义</strong>顶呱呱！",
				isLog: true,
				score: 55,
				list: ["vue", "小程序", "uni", "jq"]
			}
		},
		onLoad() {

		}
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.button {
		width: 100%;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}

	.h1,
	.h2 {
		width: 100%;
		background-color: pink;
		line-height: 2;
		box-sizing: border-box;
		padding-left: 40px;
	}

	.h2 {
		background-color: aqua;
	}
</style>
